const gulp = require('gulp');
const inject = require('gulp-inject-string');
const rollupTypescript = require('rollup-plugin-typescript2');
const rollup = require("rollup");
const concat = require('gulp-concat');
const through = require('through2');

function combie_demo() {
    return rollup.rollup(
        {
            input: './src/demo/Main.ts',
            treeshake: true,//建议忽略
            plugins: [
                rollupTypescript({
                    noEmit: true,
                    noEmitHelpers: true
                }),
            ]
        }
    ).then(bundle => {
        return bundle.write({
            file: './tmp/demo.js',
            format: 'iife',
            name: 'Demo',
            sourcemap: true
        });
    });
}

gulp.task("demo-编译ts", combie_demo);


gulp.task('demo-拷贝到bin', function () {
    return gulp.src(['./tmp/demo.js.map', './tmp/demo.js'])
        .pipe(gulp.dest('./bin'))
});
